package com.cd.system.jpa.entityImport;

import com.cd.common.domain.BaseDomain;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author admin
 * @description 操作日志记录 ||  ||
 * @date 2024-03-25
 */
@Entity
@Data
@Table(name = "sys_oper_log",
        indexes = {
                @Index(name = "idx_sys_oper_log_bt", columnList = "business_type"),
                @Index(name = "idx_sys_oper_log_s", columnList = "status"),
                @Index(name = "idx_sys_oper_log_ot", columnList = "oper_time")
        }
)
public class SysOperLog extends BaseDomain implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    //@Comment("日志主键")
    @Column(name = "oper_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long operId;

    //@Comment("模块标题")
    @Column(name = "title")
    private String title;

    //@Comment("业务类型（0其它 1新增 2修改 3删除）")
    @Column(name = "business_type")
    private Integer businessType;

    //@Comment("方法名称")
    @Column(name = "method")
    private String method;

    //@Comment("请求方式")
    @Column(name = "request_method")
    private String requestMethod;

    //@Comment("操作类别（0其它 1后台用户 2手机端用户）")
    @Column(name = "operator_type")
    private Integer operatorType;

    //@Comment("操作人员")
    @Column(name = "oper_name")
    private String operName;

    //@Comment("部门名称")
    @Column(name = "dept_name")
    private String deptName;

    //@Comment("请求URL")
    @Column(name = "oper_url")
    private String operUrl;

    //@Comment("主机地址")
    @Column(name = "oper_ip")
    private String operIp;

    //@Comment("操作地点")
    @Column(name = "oper_location")
    private String operLocation;

    //@Comment("请求参数")
    @Column(name = "oper_param", columnDefinition = "TEXT")//, length = 5000
    private String operParam;

    //@Comment("返回参数")
    @Column(name = "json_result",columnDefinition = "TEXT")
    private String jsonResult;

    //@Comment("操作状态（0正常 1异常）")
    @Column(name = "status")
    private Integer status;

    //@Comment("错误消息")
    @Column(name = "error_msg",columnDefinition = "TEXT")
    private String errorMsg;

    //@Comment("操作时间")
    @Column(name = "oper_time")
    private Date operTime;

    //@Comment("消耗时间")
    @Column(name = "cost_time")
    private Long costTime;

    @Transient
    /** 业务类型数组 */
    private Integer[] businessTypes;

}

